package com.beaut.project.control;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.beaut.project.service.CRMService;
import com.beaut.project.service.WareHouseService;



/**
 * CRM管理
 * @author jzk
 *
 */
@Controller
@RequestMapping("/crm")
public class CRMController extends BaseControl{
	@Autowired
	private CRMService crmService;
	
	@RequestMapping(value = "/listPageAccountingOut", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageAccountingOut(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	return crmService.listPageAccountingOut(map);
    }
	@RequestMapping(value = "/getAccountingById", method = RequestMethod.GET,produces = "application/json;charset=UTF-8")
	public @ResponseBody String getAccountingById(HttpServletRequest request) {
		return crmService.getAccountingById(requestParameterToMap(request));
	}
	@RequestMapping(value = "/listPageSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageWareHouse(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	return crmService.listPageSupplier(map);
    }
	@RequestMapping(value = "/listPageUnPurchaseSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageUnPurchaseSupplier(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageUnPurchaseSupplier(map);
	}
	@RequestMapping(value = "/listPageHasPurchasedSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageHasPurchasedSupplier(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageHasPurchasedSupplier(map);
	}
	@RequestMapping(value = "/getSumUnPurchaseSupplier", method = RequestMethod.POST)
	public @ResponseBody String getSumUnPurchaseSupplier(HttpServletRequest request) {
		return crmService.getSumUnPurchaseSupplier(requestParameterToMap(request));
	}
	@RequestMapping(value = "/getSumHasPurchasedSupplier", method = RequestMethod.POST)
	public @ResponseBody String getSumHasPurchasedSupplier(HttpServletRequest request) {
		return crmService.getSumHasPurchasedSupplier(requestParameterToMap(request));
	}
	
	@RequestMapping(value = "/listPageXmWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageXmWorker(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageXmWorker(map);
	}
	
	@RequestMapping(value = "/getSupplierById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
	public @ResponseBody String getSupplierById(HttpServletRequest request) {
		return crmService.getSupplierById(requestParameterToMap(request));
	}
	@RequestMapping(value = "/addSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String addSupplier(HttpServletRequest request) {
		return crmService.addSupplier(requestParameterToMap(request));
	}
	@RequestMapping(value = "/updateSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateSupplier(HttpServletRequest request) {
		return crmService.updateSupplier(requestParameterToMap(request));
	}
	@RequestMapping(value = "/deleteSupplier", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteSupplier(HttpServletRequest request) {
		return crmService.deleteSupplier(requestParameterToMap(request));
	}
	@RequestMapping(value = "/addAccounting", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String addAccounting(HttpServletRequest request) {
		return crmService.addAccounting(requestParameterToMapUser(request));
	}
	@RequestMapping(value = "/updateAccounting", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateAccounting(HttpServletRequest request) {
		return crmService.updateAccounting(requestParameterToMapUser(request));
	}
	@RequestMapping(value = "/deleteAccounting", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteAccounting(HttpServletRequest request) {
		return crmService.deleteAccounting(requestParameterToMap(request));
	}
	@RequestMapping(value = "/listPageCustomer", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageCustomer(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageCustomer(map);
	}
	@RequestMapping(value = "/getCustomerById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
	public @ResponseBody String getCustomerById(HttpServletRequest request) {
		return crmService.getCustomerById(requestParameterToMap(request));
	}
	@RequestMapping(value = "/addCustomer", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String addCustomer(HttpServletRequest request) {
		return crmService.addCustomer(requestParameterToMap(request));
	}
	@RequestMapping(value = "/updateCustomer", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateCustomer(HttpServletRequest request) {
		return crmService.updateCustomer(requestParameterToMap(request));
	}
	@RequestMapping(value = "/deleteCustomer", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteCustomer(HttpServletRequest request) {
		return crmService.deleteCustomer(requestParameterToMap(request));
	}
	
	@RequestMapping(value = "/listPageWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageWorker(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageWorker(map);
	}
	@RequestMapping(value = "/getWorkerById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
	public @ResponseBody String getWorkerById(HttpServletRequest request) {
		return crmService.getWorkerById(requestParameterToMap(request));
	}
	@RequestMapping(value = "/addWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String addWorker(HttpServletRequest request) {
		return crmService.addWorker(requestParameterToMap(request));
	}
	@RequestMapping(value = "/updateWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateWorker(HttpServletRequest request) {
		return crmService.updateWorker(requestParameterToMap(request));
	}
	@RequestMapping(value = "/deleteWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteWorker(HttpServletRequest request) {
		return crmService.deleteWorker(requestParameterToMap(request));
	}
	@RequestMapping(value = "/listPageSupplierFinanceOutDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageSupplierFinanceOutDetail(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageSupplierFinanceOutDetail(map);
	}
	@RequestMapping(value = "/listPageSupplierFinanceOutLog", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageSupplierFinanceOutLog(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageSupplierFinanceOutLog(map);
	}
	@RequestMapping(value = "/listPageWorkerFinanceOutDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageWorkerFinanceOutDetail(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageWorkerFinanceOutDetail(map);
	}
	@RequestMapping(value = "/listPageWorkerFinanceOutLog", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageWorkerFinanceOutLog(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageWorkerFinanceOutLog(map);
	}
	@RequestMapping(value = "/listPageCustomerFinanceInDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageCustomerFinanceInDetail(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageCustomerFinanceInDetail(map);
	}
	@RequestMapping(value = "/listPageCustomerFinanceInLog", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String listPageCustomerFinanceInLog(HttpServletRequest request) {
		Map<String, Object> map = getPagerMap(request);
		map.putAll(requestParameterToMap(request));
		return crmService.listPageCustomerFinanceInLog(map);
	}
}
